﻿	Ext.onReady(function(){	

		Ext.BLANK_IMAGE_URL = "extjs/resources/images/default/s.gif";

		Ext.QuickTips.init();	
		
		var _top = new Ext.Panel({
						region:"north",
						//title:"标题",
						height:40,
						border:true,
						html:"LOGO",
						margins:'0 0 5 0'
					});
		var _left = new Ext.tree.TreePanel({
						region:"west",
						collapsible:true,
						title:"导航菜单",
						width:200,
						autoScroll:true,
						rootVisible:false,
						split:true,
						listeners:{
							click:function(_node){								
									var _url = _node.attributes.url;
									var _id = _node.id;//如果没有宝，则自动生成唯一的ID
									var _p = _center.getItem(id);//获取节点ID对应的标签面板
									if(_url){//具有URL值
										if(_p){
											//此面板已经存在，只需要激活就可以了。
											_center.setActiveTabl(_p);
										} else {
											//如果不存在，则创建新的面板，并激活
											_p = new Ext.Panel({
													title:_node.text,
													//autoLoad:{url:_url,scripts:true},
													html : "<iframe src=\"" + _url + "\" style='height:100%;width:100%;' frameborder=0></iframe>",
													closable:true,//标签上出现关闭按钮
													autoScroll:true,
													id:_id//这里一定设置
												});
											_center.add(_p);
											_center.setActiveTab(_p);
										}
									}
								}
						}
					});
					
		/********************定义树结构**********************/
		// 一级导航
		var _root = new Ext.tree.TreeNode({
			id:"root",
			text:"根节点"
		});
		
		// 教师管理
		var menuTeacherManager = new Ext.tree.TreeNode({
			id:"menuTeacherManager",
			text:"教师管理",
			expanded:true
		});
		
		// 教师添加
		var teacherAddMenu = new Ext.tree.TreeNode({
			id:"teacherAddMenu",
			text:"教师添加",
			url: "dean/teacherAdd.jsp"
		});
		
		// 教师管理
		var teacherManageMenu = new Ext.tree.TreeNode({
			id:"teacherManageMenu",
			text:"教师管理",
			url: "dean/teacherManage.jsp"
		});
		
		// 教师查询
		var teacherQueryMenu = new Ext.tree.TreeNode({
			id:"teacherQueryMenu",
			text:"教师查询",
			listeners:{
			}
		});
		
		menuTeacherManager.appendChild([teacherManageMenu,teacherAddMenu,teacherQueryMenu]);
		
			// 学生管理
		var menuGraduateManager = new Ext.tree.TreeNode({
			id:"menuGraduateManager",
			text:"学生管理",
			expanded:true
		});
		
		// 学生添加
		var graduateAddMenu = new Ext.tree.TreeNode({
			id:"graduateAddMenu",
			text:"学生添加",
			listeners:{
				// "click":payOutManageFn
			}
		});
		
		// 学生管理
		var graduateManageMenu = new Ext.tree.TreeNode({
			id:"graduateManageMenu",
			text:"学生管理",
			listeners:{
			}
		});
		
		// 学生查询
		var graduateQueryMenu = new Ext.tree.TreeNode({
			id:"graduateQueryMenu",
			text:"学生查询",
			listeners:{
			}
		});
		
		menuGraduateManager.appendChild([graduateManageMenu,graduateAddMenu,graduateQueryMenu]);
		
		_root.appendChild([menuTeacherManager,menuGraduateManager]);
		_left.setRootNode(_root);
		
		
		var _center = new Ext.TabPanel({
						region:"center",
						items:{
							id:"opt1",
							title:"默认页面",
							tabTip:"这是默认页面，不可以关闭",
							html:"欢迎"
						},
						enableTabScroll:true
						//activeItem:0
					});
		_center.setActiveTab("opt1");
		
		var _bottom = new Ext.Panel({
						region:"south",
						title:"Information",
						collapsible:true,
						html:"版权所有，翻版必究",
						split:true,
						height:100,
						bodyStyle : "padding: 10px; font-size: 12px; text-align:center;"
					});
		var _bottom2 = new Ext.Panel({
						region:"south",
						height:60,
						frame:true,
						items:new Ext.Toolbar({
							height:20,
							items:[{
								xtype:'label',
								text:'081251212 张镞'
							}]
						})
					});
					
		var _vp = new Ext.Viewport({
					layout:"border",
					items:[{
						xtype : 'box',
						region : 'north',
						applyTo : 'main',
						height : 50,
						split : false
					},
					//_top
					_left,_center
					,_bottom2
					]
				});
		
		_left.expandAll();
	});